package com.flute.tools.sql;

public class WhereSQL implements ISQL {
	/**
	 * 
	 */
	private static final long serialVersionUID = 7905349494437641117L;
	private FieldValuesSQL fieldValues;

	public WhereSQL() {
		this.fieldValues = new FieldValuesSQL(" and ");
	}

	public void addCondition(String field, String value) {
		this.fieldValues.addFieldValue(field, value);
	}
	
	public void addCondition(SQLCondition condition){
		this.fieldValues.addSQLCondition(condition);
	}

	@Override
	public String getSQLString() {
		if (fieldValues.size() == 0) {
			return "";
		} else {
			return " where " + fieldValues.getSQLString();
		}
	}

}
